package Stream流;

import java.util.Arrays;

public class 数据过滤Num1 {
    /*
    * 定义一个集合，添加元素1,2,3,4,5,6,7,8,9,10
    * 过滤奇数，保留偶数
    * 并将过滤后的元素存到数组中
    * */
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        int[] arr1 = Arrays.stream(arr).filter(s -> s % 2 == 0).toArray();
        System.out.println(Arrays.toString(arr1));
    }
}
